package oj;

public class Num1154 {
    public int dayOfYear(String date) {
        String[] arr=date.split("-");
        int[] dayOfMonth={0,31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if(isLeapYear(Integer.parseInt(arr[0])))
            dayOfMonth[2]++;

        int count=0;
        for (int i = 1; i <Integer.parseInt(arr[1]); i++) {
            count+=dayOfMonth[i];
        }
        return count+Integer.parseInt(arr[2]);

    }
    private static boolean isLeapYear(int i){
        return (i%100!=0&&i%4==0) || i%400==0;
    }
}
